package org.demo.controller;

import org.demo.common.Result;
import org.demo.entity.Appointments;
import org.demo.entity.Community;
import org.demo.entity.PageBean;
import org.demo.entity.Performance;
import org.demo.service.ICommunityService;
import org.demo.service.IPerformanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//业绩表
@RestController
@RequestMapping("/performance")
public class PerformanceConteoller {
    @Autowired
    private IPerformanceService performanceService;
    @PostMapping("/add")
    public Result add(@RequestBody Performance performance){
        performanceService.add(performance);
        return Result.success();
    }
    @PostMapping("/Pagelist")
    public Result<PageBean<Performance>> Pagelist(Integer pageNum,
                                                   Integer pageSize,
                                                   @RequestBody (required = false) Performance performance){
        PageBean<Performance> pb= performanceService.Pagelist(pageNum,pageSize,performance);
        return Result.success(pb);
    }
    @GetMapping("/list")
    public Result<List<Performance>> list(@RequestBody (required = false) Performance performance){
        List<Performance> list= performanceService.list(performance);
        return Result.success(list);
    }
    @PutMapping("/update")
    public Result update(@RequestBody Performance performance){
        performanceService.update(performance);
        return Result.success();
    }
    @DeleteMapping("/delete")
    public  Result delete(String id){
        performanceService.delete(id);
        return Result.success();
    }

}
